package com.shujia.wyh.day06.ketang;

/*
    假如我们在开发一个系统时需要对员工类进行设计，员工包含3个属性：姓名、工号以及工资。
    经理也是员工，除了含有员工的属性外，另为还有一个奖金属性。
    请使用继承的思想设计出员工类和经理类。要求类中提供必要的方法进行属性访问。

 */

abstract class Staff{
    private String name;
    private String id;
    private int salary;

    public Staff() {
    }

    public Staff(String name, String id, int salary) {
        this.name = name;
        this.id = id;
        this.salary = salary;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public int getSalary() {
        return salary;
    }

    public void setSalary(int salary) {
        this.salary = salary;
    }

    public abstract void work();
}

class CommonStaff extends Staff{

    public CommonStaff() {
    }

    public CommonStaff(String name, String id, int salary) {
        super(name, id, salary);
    }

    @Override
    public void work() {
        System.out.println("敲代码");
    }
}

//PM
//实现方法的快捷键 alt+enter
class ProjectManager extends Staff{
    private int bonus;

    public ProjectManager() {
    }

    public ProjectManager(String name, String id, int salary, int bonus) {
        super(name, id, salary);
        this.bonus = bonus;
    }

    public int getBonus() {
        return bonus;
    }

    public void setBonus(int bonus) {
        this.bonus = bonus;
    }

    @Override
    public void work() {
        System.out.println("做PPT");
    }
}

public class DuoTaiTest2 {
    public static void main(String[] args) {
        //创建一个普通员工对象
        Staff s1 = new CommonStaff("吴涛","Ali001",100000);
        s1.work();
        System.out.println("===========================");
        //创建一个经理对象
        ProjectManager projectManager = new ProjectManager("陈涛", "TX001", 120000, 500000);
        projectManager.work();
    }
}
